import {defineStore} from 'pinia'
import {reactive} from "vue";

export const useGridStore = defineStore('grid', () => {
    const state = reactive({
        gridData: [
            {
                cableSection: '1',
                lineName: '10kV果园线',
                cableSectionTerminal: '黄金站开关309至东高#1开关301',
                routineTest: '严重缺陷',
                avgLoadRate: '36.87%',
                maxLoadRate: '76.37%',
                operationYears: '5',
                threeYearFaults: '0',
                threeYearOtherFaults: '0',
                cablePath: '黄金路电缆通道',
                cableNumber: '30',
                pathEnvironment: '良好',
                avgCableNumber: '6',
                avgLoadVolume: '0',
                cableType: '终端头1',
                makerFaultRates: [6],
                makerFaultRateNames: ['终端头1'],
                crossTestStatus: ['合格'],
                cableSegment: [{startPoint: '果园线段1', riskScore: 96, riskLevel: '高风险'},
                    {startPoint: '果园线段2', riskScore: 87, riskLevel: '高风险'},
                    {startPoint: '果园线段3', riskScore: 84, riskLevel: '高风险'}]
            },
            {
                cableSection: '2',
                lineName: '10kV红氢线',
                // cableSectionTerminal: '联诚国际开 关站307至020杆',
                cableSectionTerminal: '东高#1开关301至020杆',
                routineTest: '一般缺陷',
                avgLoadRate: '27.18%',
                maxLoadRate: '108.28%',
                operationYears: '18',
                threeYearFaults: '0',
                threeYearOtherFaults: '0',
                cablePath: '文源中路电缆通道',
                cableNumber: '11',
                pathEnvironment: '一般',
                avgCableNumber: '5',
                avgLoadVolume: '0',
                cableType: '终端头1',
                makerFaultRates: [3, 5],
                makerFaultRateNames: ['终端头1', '终端头2'],
                crossTestStatus: ['合格', '合格'],
                cableSegment: [{startPoint: '红氢线段1', riskScore: 75, riskLevel: '中风险'},
                    {startPoint: '红氢线段2', riskScore: 68, riskLevel: '中风险'},]
            },
            {
                cableSection: '3',
                lineName: '10kV金湖线',
                cableSectionTerminal: '吉祥村开关站307至301',
                routineTest: '严重缺陷',
                avgLoadRate: '35.14%',
                maxLoadRate: '44.16%',
                operationYears: '10',
                threeYearFaults: '1',
                threeYearOtherFaults: '0',
                cablePath: '金甲冲路电缆通道',
                cableNumber: '25',
                pathEnvironment: '一般',
                avgCableNumber: '7',
                avgLoadVolume: '0',
                cableType: '终端头1',
                makerFaultRates: [7, 6, 11, 8],
                makerFaultRateNames: ['终端头1', '中间头1', '中间头2', '终端头2'],
                crossTestStatus: ['合格', '合格', '合格', '合格'],
                cableSegment: [{startPoint: '金湖线段1', riskScore: 55, riskLevel: '低风险'}]
            },
            {
                cableSection: '4',
                lineName: '10kV华城线',
                cableSectionTerminal: '华城路#1开关站303至华城路#2开关站301',
                routineTest: '严重缺陷',
                avgLoadRate: '55.65%',
                maxLoadRate: '74.09%',
                operationYears: '4',
                threeYearFaults: '0',
                threeYearOtherFaults: '0',
                cablePath: '华城路电缆通道',
                cableNumber: '10',
                pathEnvironment: '一般',
                avgCableNumber: '3',
                avgLoadVolume: '0',
                cableType: '终端头1',
                makerFaultRates: [12, 9, 10],
                makerFaultRateNames: ['终端头1', '中间头1', '中间头2'],
                crossTestStatus: ['合格', '合格', '合格']
            },
            {
                cableSection: '5',
                lineName: '10kV富桥线',
                cableSectionTerminal: '黄桥#1开关站301至黄桥开关站301',
                routineTest: '严重缺陷',
                avgLoadRate: '29.35%',
                maxLoadRate: '45.61%',
                operationYears: '7',
                threeYearFaults: '0',
                threeYearOtherFaults: '0',
                cablePath: '黄桥路电缆通道',
                cableNumber: '18',
                pathEnvironment: '良好',
                avgCableNumber: '4',
                avgLoadVolume: '0',
                cableType: '终端头1',
                makerFaultRates: [10, 9, 10, 10],
                makerFaultRateNames: ['终端头1', '中间头1', '中间头2', '终端头2'],
                crossTestStatus: ['合格', '合格', '合格', '合格']
            },
            {
                cableSection: '6',
                lineName: '10kV向东1回',
                cableSectionTerminal: '东华路开关站301至宝灵变342间隔',
                routineTest: '严重缺陷',
                avgLoadRate: '19.70%',
                maxLoadRate: '98.90%',
                operationYears: '9',
                threeYearFaults: '0',
                threeYearOtherFaults: '0',
                cablePath: '东华路电缆通道',
                cableNumber: '35',
                pathEnvironment: '差',
                avgCableNumber: '6',
                avgLoadVolume: '0',
                cableType: '终端头1',
                makerFaultRates: [6, 4, 4, 13, 13, 13],
                makerFaultRateNames: ['终端头1', '中间头1', '中间头2', '中间头3', '中间头4', '终端头2'],
                crossTestStatus: ['合格', '合格', '合格', '合格', '合格', '合格']
            },
            {
                cableSection: '7',
                lineName: '10kV横梁线',
                cableSectionTerminal: '东华路开关站303至正华#5开关站301',
                routineTest: '严重缺陷',
                avgLoadRate: '45.16%',
                maxLoadRate: '66.70%',
                operationYears: '4',
                threeYearFaults: '0',
                threeYearOtherFaults: '0',
                cablePath: '东华路电缆通道',
                cableNumber: '22',
                pathEnvironment: '良好',
                avgCableNumber: '5',
                avgLoadVolume: '0',
                cableType: '终端头1',
                makerFaultRates: [4, 5, 7, 6],
                makerFaultRateNames: ['终端头1', '中间头1', '中间头2', '终端头2'],
                crossTestStatus: ['合格', '合格', '合格', '合格']
            },
            {
                cableSection: '8',
                lineName: '10kV机线',
                cableSectionTerminal: '机木#2开关站303至机木#3开关站301',
                routineTest: '一般缺陷',
                avgLoadRate: '50.19%',
                maxLoadRate: '70.71%',
                operationYears: '4',
                threeYearFaults: '0',
                threeYearOtherFaults: '1',
                cablePath: '机木路电缆通道',
                cableNumber: '16',
                pathEnvironment: '良好',
                avgCableNumber: '4',
                avgLoadVolume: '0',
                cableType: '终端头1',
                makerFaultRates: [6, 5, 5],
                makerFaultRateNames: ['终端头1', '中间头1', '终端头2'],
                crossTestStatus: ['合格', '合格', '合格']
            }
        ],
        cableSegmentGridData: [],
        cableSegmentData: [],
        data: []
    })

    const setCableSegmentGridData = (value) => {
        state.cableSegmentGridData = value
    }

    const setCableSegmentData = (value) => {
        state.cableSegmentData = value
    }

    const setData = (value) => {
        state.data = value
    }

    return {state, setCableSegmentGridData, setCableSegmentData, setData}
})
